#define _CRT_SECURE_NO_WARNINGS 1;

#include "string.h"

namespace wlc
{
	void test_string1()
	{
		string s1;
		cout << s1.c_str() << endl;

		string s2("hello word!");
		
		for (size_t i = 0; i < s2.size(); i++)
		{
			cout << s2[i] << " ";
			s2[i]++;
		}
		cout << endl;
		cout << s2.c_str() << endl;

		for (auto ch : s2)
		{
			cout << ch << " ";
		}
		cout << endl;

		string::iterator it1 = s2.begin();
		while (it1 != s2.end())
		{
			cout << (*it1) << " ";
			it1++;
		}
		cout << endl;

		const string s3("hello word!");
		string::const_iterator it2 = s3.begin();
		while (it2 != s3.end())
		{
			cout << (*it2) << " ";
			it2++;
		}
		cout << endl;
	}


	void test_string2()
	{
		string s1("hello word!");
		s1.push_back('a');
		s1.push_back('b');
		s1.append("cdefg");
		s1 += 'e';
		s1 += "fghi";
		s1 += '\0';
		s1 += '!';
		s1 += "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
		cout << s1 << endl;
	}

	void test_string3()
	{
		string s1("abcdefg");

		cout << s1.find("fg") << endl;

		cout << s1.substr(2) << endl;
		string s2("abcdefg");
		cout << (s1 <= s2) << endl;
	}

	void test_string4()
	{
		string s1("hello word!");

		cin >> s1;

		cout << s1 << endl;

		//getline(cin, s1);
		cout << s1 << endl;
		cout << "_size" << s1.size() << endl;
	}

	void test_string5()
	{
		string s1("hello word!");
		string s2;

		s2 = s1;
		s1 += 'a';
		cout << s1 << endl;
		cout << s2 << endl;

	}
}

int main()
{
	//wlc::test_string1();
	//wlc::test_string2();
	//wlc::test_string3();
	//wlc::test_string4();
	wlc::test_string5();
	return 0;
}